<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'my-empmovelist.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script> 
<script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>

<!-- easyui -->
	<link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.4.5/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.4.5/themes/default/easyui.css">
	<script type="text/javascript" src="js/jquery-easyui-1.4.5/jquery.min.js"></script>
    <script type="text/javascript" src="js/jquery-easyui-1.4.5/jquery.easyui.min.js"/>
    <script type="text/javascript" src="js/jquery-easyui-1.4.5/locale/easyui-lang-zh_CN.js"></script>
	
     <script type="text/javascript">
       $(function(){
         // alert('xxx');
         $("#gridtab").datagrid({
             url:'empmove/mylist.action' 
          });
       })
     function olddept(vv,rows,index)
     {
             // alert(vv.name);
             return vv.de_name;
     }
       
       function newdept(vv,rows,index)
       {
             // alert(vv.name);
             if(vv==null) return '';
             else return vv.de_name;
       }
       
       function oldrole(vv,rows,index)
       {
             // alert(vv.name);
             return vv.ro_name;
       }
       
       function newrole(vv,rows,index)
       {
             // alert(vv.name);
             if(vv==null) return '';
             else return vv.ro_name;
       }
       
       function empxx(vv,rows,index)
       {
            // alert(vv.us_name);
             return vv.us_name;
       } 
       
       function apply(id)
       {
          $.get("empmove/apply.action","id="+id,function(res){
          if(res.trim()=='succ')
          {
              $('#gridtab').datagrid('reload'); 
          }   
          });
       }
       
       function delconf(id)
       {
          if(confirm("你确定要删除么？"))
          {
             location="empmove/del/"+id+".action";
          }
       }
       
       function dealman(vv,rows,index)
       {
            if(vv==null) return '';
            else return vv.us_name;
       }
       
       
       
       function todo(vv,rows,index){
         if(rows.mo_check_status=='新增')
         {
           var  str="<a href='javascript:apply("+rows.mo_id+")'>提交</a>"
                   +"||<a href='javascript:void(0)' onclick=\"admin_edit('修改调度申请表','empmove/getbyid/1.action?id="+rows.mo_id+"','"+rows.mo_id+"','800','500')\">修改</a>"
                   +"||<a href='javascript:delconf("+rows.mo_id+")'>删除</a>";
         }else if(rows.mo_check_status=='打回')
         {
            var  str="<a href='javascript:void(0)' onclick=\"admin_edit('修改调度申请表','empmove/getbyid/1.action?id="+rows.mo_id+"','"+rows.mo_id+"','800','500')\">修改</a>"
                   +"||<a href='javascript:delconf("+rows.mo_id+")'>删除</a>";
         }else if(rows.mo_check_status=='待处理')
         {
           var str="<span>审核中...</span>";
         }else
         {
           var str="<a href='javascript:delconf("+rows.mo_id+")'>删除</a>";
         }  
         return str;
       }
       
       
      
        
        /***增加**/
      function admin_add(title,url,w,h){
	    layer_show(title,url,w,h);
	
     }
   /*修改*/
   function admin_edit(title,url,id,w,h){
	layer_show(title,url,w,h);
  }
     </script>

  </head>
  
  <body>
    <div class="cl pd-5 bg-1 bk-gray mt-20" id="add">
    <div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l">
    <a href="javascript:;" onclick="admin_add('申请调度','empmove-add.jsp','800','500')" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 申请调度</a></span>  </div>
    <a href="javascript:;" onclick="admin_add('申请离职','empmove-add-arrive.jsp','800','500')" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 申请离职</a></span>  </div>
    </div>
    <table id="gridtab" class="easyui-datagrid"  style="width:1200px;"
      data-options="pagination:true,rownumbers:true,toolbar:'#add',fitColumns:true"
     >
      <thead>
        <tr>
                <th data-options="field:'mo_id'">编号</th> 
			    <th data-options="field:'mo_type'">类型</th>
				<th data-options="field:'old_de_id',formatter:olddept,width:500">原部门</th>
				<th data-options="field:'old_ro_id',formatter:oldrole,width:500">原角色</th>
				<th data-options="field:'new_de_id',formatter:newdept,width:500">申请的部门</th>
				<th data-options="field:'new_ro_id',formatter:newrole,width:500">申请的角色</th>
				<th data-options="field:'dealman',formatter:dealman,width:500">处理人</th>  
				<th data-options="field:'mo_check_status',width:800">状态</th>
				<th data-options="field:'mo_check_time',width:800">申请时间</th>
			    <th data-options="field:'xx',formatter:todo,width:1500">操作</th> 
        </tr>
      </thead>
    </table>
 
 
  </body>
</html>
